import service from "@/utils/request";
const api = `http://${localStorage.getItem('localIP')}:6001`
// 登录
export const login = (data) => {
  return service({
    url: api+`/login`,
    method: "post",
    data,
  });
};

// 患者列表
export const getAllPat = (data) => {
  return service({
    url: api+`/pat/getAllPat`,
    method: "get",
    data,
  });
};


// 用药信息
// GET http://localhost:8080/pat/getDrugs/{{patId}}
export const getDrugs = (data) => {
  return service({
    url: api+`/pat/getDrugs/${data}`,
    method: "get",
  });
};
// 专家列表
export const getAll = (data) => {
  return service({
    url: api+`/specialist/getAll`,
    method: "get",
    headers: {
      'userId': data,
    }
  });
};


// 上传影像
// http://localhost:8080/file/upload
export const upload = (data) => {
  return service({
    url: api+`/file/upload`,
    method: "post",
    data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  });
};
// 查询影像
// http://localhost:8080/file/getFileList?
export const getFileList = (data) => {
  return service({
    url: api+`/file/getFileList?patId=${data.patId}&type=${data.type}`,
    method: "get",
  });
}


// 申请
// http://localhost:8080/msg/addMsg
export const addMsg = (data) => {
  return service({
    url: api+`/msg/addMsg`,
    method: "post",
    data,
  });
};
// chatgpt

export const chatgpt = (data) => {
  return service({
    url: `https://api.deepseek.com/chat/completions`,
    method: "post",
     headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer sk-910c28f0d465447e82215ed3214b759b"
      
    },
    data,
   
  });
};

// 体征数据
// GET http://localhost:8080/pat/getVitalInfo/234
export const getVitalInfo = (data) => {
  return service({
    url: api+`/pat/getVitalInfo/${data}`,
    method: "get",
  });
}

// 用药情况
// export const getdrug = (data) => {
//   return service({
//     url: `/pat-drug/list`,
//     method: "get",
//     data
//   });
// }

// 检验信息
export const getExamine = (data) => {
  return service({
    url: api+`/patExamine/list/${data}`,
    method: "get",
    data
  });
}


// 会诊列表

export const getSpecialist = (data) => {
  return service({
    url: api+`/msg/getPatDiagnosis/${data}`,
    method: "get",
    data
  });
}



// 申请列表
export const getSendMsg = (data) => {
  return service({
    url: api+`/msg/getSendMsg/${data}`,
    method: "get",
    data
  });
}


// 受邀列表
// getReceive


export const getReceive = (data) => {
  return service({
    url: api+`/msg/getReceive/${data}`,
    method: "get",
    data
  });
}


// 提交诊断结果
export const updateMsg = (data) => {
  return service({
    url: api+`/msg/updateMsg`,
     method: "post",
    data,
  });
}
